cmake_minimum_required(VERSION 3.20)
set(CMAKE_VERBOSE_MAKEFILE ON)
project(Lorepona VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Gui Core5Compat)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Gui Core5Compat)


file(GLOB PROJECT_SOURCES source/*/*.cpp)
file(GLOB PROJECT_HEADERS include/*/*.h)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(Lorepona
        MANUAL_FINALIZATION
        main.cpp
        ${PROJECT_SOURCES}
        ${PROJECT_HEADERS}
        images.qrc
    )
    target_include_directories(Lorepona PRIVATE include)
# Define target properties for Android with Qt 6 as:
#    set_property(TARGET Diplom APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
#                 ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
    if(ANDROID)
        add_library(Lorepona SHARED
            ${PROJECT_SOURCES}
        )
# Define properties for Android with Qt 5 after find_package() calls as:
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
    else()
        add_executable(Lorepona
            ${PROJECT_SOURCES}
        )
    endif()
endif()
#add_subdirectory(${gost-engine_SOURCE_DIR} ${gost-engine_BINARY_DIR})
include(cmake/getLibs.cmake)
DownloadLibs()
# Передаем значение переменной окружения влияющей на OpenSSL

target_link_libraries(Lorepona PRIVATE Qt6::Core Qt${QT_VERSION_MAJOR}::Widgets  Qt6::Gui ${LinkLibraries} Qt6::Core5Compat)
target_include_directories(Lorepona PRIVATE ${LinkInclude})

set_source_files_properties(${CMAKE_SOURCE_DIR}/resources/small_icon.png PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/Info.plist)
set_target_properties(Lorepona PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE_ICON_FILE small_icon.png
)


if(QT_VERSION_MAJOR EQUAL 6)
    qt_finalize_executable(Lorepona)
endif()
